package com.whfc.openapi.api.emp.controller;

import com.whfc.common.result.Result;
import com.whfc.common.result.ResultUtil;
import com.whfc.openapi.api.emp.service.OpenApiJxEmpService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/open/api/jx/anon")
public class OpenApiJXEmpController {
    private Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private OpenApiJxEmpService openApijXEmpService;

    @PostMapping("/employee/saveOrEdit")
    public Result saveOrEdit(@RequestBody String param) {
        logger.info("======接收九象添加人员,param:{}", param);
        openApijXEmpService.saveOrEdit(param);
        return ResultUtil.success();
    }

    @PostMapping("/employee/exit")
    public Result empExit(@RequestBody String param) {
        logger.info("======接收九象人员退场,param:{}", param);
        openApijXEmpService.empExit(param);
        return ResultUtil.success();
    }

    @PostMapping("/attendance/record/save")
    public Result attendanceSave(@RequestBody String param) {
        logger.info("======接收九象考勤记录,param:{}", param);
        openApijXEmpService.attendanceSave(param);
        return ResultUtil.success();
    }

    @PostMapping("/attendance/record/saveDevice")
    public Result saveDevice(@RequestBody String param) {
        logger.info("======接收九象新增考勤设备数据,param:{}", param);
        openApijXEmpService.saveDevice(param);
        return ResultUtil.success();
    }


    @PostMapping("/employee/work/type/saveOrEdit")
    public Result workTypeSaveOrEdit(@RequestBody String param) {
        logger.info("======接收九象工种信息,param:{}",  param);
        openApijXEmpService.workTypeSaveOrEdit(param);
        return ResultUtil.success();
    }

    @PostMapping("employee/team/saveOrEdit")
    public Result teamSaveOrEdit(@RequestBody String param) {
        logger.info("======接收九象班组信息,param:{}",param);
        openApijXEmpService.teamSaveOrEdit(param);
        return ResultUtil.success();
    }
}
